__________________________________________________________________

                Title:  2 Player Battleships 
              Version:  1.0
               Author:  Maverick - 106053.2370@compuserve.com
                 Size:  2500 bytes (approx)
                Model:  Fx7700 or better.
          Description:  Play Battleships on two calculators so
                        each player cannot see the others ships.
                        No leads required!!
                         
__________________________________________________________________                      

          Uses NUMBERS.TXT by Kim Hedin (slightly re-written).

       INSTRUCTIONS
       Put a copy of Battleships onto both calculators you will use.
       Run the two Prog 1 files, and each player enters their ships.
       Then each player will be given an encoded set of numbers.
                - I.E.:         TELL - 120061353
       These should be typed into to the other calculator, at the
        RESPONSE? request. You can now play, by calling your numbers
       to each other as you fire. The rest is done by the calculators on
       their own - no more silly codes or leads are needed.
               
       COMMAND TRANSLATION

                _        'display'              (SHIFT, 7, F5)
                <>       'not equal to'         (SHIFT, 7, F2, F2)
                <=       'less than or equal to'(SHIFT, 7, F2, F6)
                >=       'more than or equal to'(SHIFT, 7, F2, F5)
                ->       'put in to'             
                =>       'then'                 (SHIFT, 7, F1, F1) 
              Ran#       gives a random number. (SHIFT, 5, F2, F4)
                /        divide    
                r        Small r variable       (ALPHA,Graph)
                @        Theta variable         (ALPHA,Range)

       Lines beginning with # should be ignored.
       I have used lower case text inside " and ' signs.       
       You must put them in in capitals on your calculator.
___________________________________________________________________
                  
       PROGRAM

Prog 1

'BattleShips
Defm 50:Fix 0:Mcl
" ~BATTLESHIPS~"
" "
"The Board is    Numbered Like   This:"_
Prog B:Prog C
" "_
"Place Your Ships"
"Ship 1"?->A[1]
"Ship 2"?->A[2]
"Ship 3"?->A[3]
"Ship 4"?->A[4]
"Ship 5"?->A[5]
Int (9Ran#+1)->X~Y
(A[1]*10*Y)+X->X
(A[2]*10000*Y)+X->X
(A[3]*10000000*Y)+X->X
"TELL:":X_
"RESPONSE"?->X
10(Frac (X/10))->Y
(X-Y)/10->X
1000(Frac (X/1000))->@
@/Y->F[1]
(X-@)/1000->X
1000(Frac (X/1000))->@
@/Y->F[2]
(X-@)/1000->X
X/Y->F[3]
Int (9Ran#+1)->X~Y
(A[4]*10*Y)+X->X
(A[5]*10000*Y)+X->X
"TELL:":X_
"RESPONSE"?->X
10(Frac (X/10))->Y
(X-Y)/10->X
1000(Frac (X/1000))->@
@/Y->F[4]
(X-@)/1000->X
X/Y->F[5]
Prog A

Prog A

'BS Turns
0->Z[1]~Z[45]
5->P~Q
"Are You Going"
"(1)st or (2)nd"?->L
L=2=>Goto 2
Lbl 1
Prog D
P=0=>Prog F
Lbl 2
Prog E
Q=0=>Prog G
Goto 1

Prog B

'BS Board
Range 0,72,99,0,40,99
Cls
Plot 72,0
Plot 72,40
Line
Plot 0,40
Line
Plot 8,0
Plot 8,40
Line
Plot 16,0
Plot 16,40
Line
Plot 24,0
Plot 24,40
Line
Plot 32,0
Plot 32,40
Line
Plot 40,0
Plot 40,40
Line
Plot 48,0
Plot 48,40
Line
Plot 56,0
Plot 56,40
Line
Plot 64,0
Plot 64,40
Line
Plot 0,8
Plot 72,8
Line
Plot 0,16
Plot 72,16
Line
Plot 0,24
Plot 72,24
Line
Plot 0,32
Plot 72,32
Line

Prog C

'BS Numbers
1->N:1->V:34->W
Lbl 1
Prog N
Isz N
V+8->V
N<=9=>Goto 1
10->N:1->V:26->W
Lbl 2
Prog N
N+9->N:W-8->W
V-4->V
W>=0=>Goto 2
45->N
2->W:65->V
Prog N


Prog D

'BS Shoot
" "
"Your Shot......."
Prog B
1->T
Lbl 1
T->X
Z[T]=1=>Prog I
Z[T]=1=>Prog J
Isz T
T<=45=>Goto 1
" "_
"Ships To Find:":Q_
"    Fire At:"
"0-To See Numbers"?->X:X->R:X->@
X=0=>Prog B
X=0=>Prog C
X=0=>" "_
X=0=>Goto 0
1->Z[R]
Prog I
Plot V,W
Plot V+8,W+8
Line:1->S
Lbl 5
R=F[S]=>Goto 9
Lbl 4
Isz S
S<6=>Goto 5
Plot V+8,W
Plot V,W+8
Line_
" "
"MISS"
" "
Goto 7
Lbl 9
Prog H
0->F[S]
Q-1->Q
" "
"HIT!!"
" "
Lbl 7

Prog E

'BS Enemy
" "
"Return Fire"
Prog B:" "
1->S
Lbl 3
A[S]=0=>Goto 4
A[S]->X
Prog I
Prog H
Lbl 4
Isz S
S<6=>Goto 3
" Where Does The"
"  Enemy Fire"?->X:X->R:1->S
Prog I
Plot V,W
Plot V+8,W+8
Line
Lbl 1
R=A[S]=>Goto 2
Lbl 6
Isz S
S<6=>Goto 1
Plot V+8,W
Plot V,W+8
Line_
" "
"MISS"
" "
Goto 8
Lbl 2
" "_
"HIT!!"
" "
P-1->P
0->A[S]
Lbl 8

Prog F

'BS Lose
" "
"No Ships Left..."
" "
"      YOU"
"    HAVE LOST"
Defm 0
Norm
Lbl 1:Goto 1

Prog G

'BS Win
" "
"      YOU"
"   HAVE WON!"
" "
"Good Shooting..."
Defm 0
Norm
Lbl 1:Goto 1

@@ Prog H ( )
'BS Ship
Plot V+2,W+3
Plot V+6,W+3
Line
Plot V+1,W+3.5
Plot V+7,W+3.5
Line
Plot V+3,W+4
Plot V+5,W+4
Line
Plot V+3,W+4.5
Plot V+5,W+4.5
Line

Prog I

'BS Locate
32->W:X->V
Lbl 5
V>9=>W-8->W
V>9=>V-9->V
V>9=>Goto 5
8V-8->V

Prog J

'BS Cross
Plot V,W
Plot V+8,W+8
Line
Plot V+8,W
Plot V,W+8
Line

Prog N

'Numbers
1->U
N->r
N>.1=>Int log N+1->U
Lbl 0
# (10^) is the small 10 sign (SHIFT-log)
Int (10Frac (r/(10^)U))->N
Prog O
U=1=>Goto 1
Dsz U
V+4->V
Goto 0
Lbl 1
r->N

Prog O

'NDraw
N=1=>Goto 1
N=2=>Goto 2
N=3=>Goto 3
N=4=>Goto 4
N=5=>Goto 5
N=6=>Goto 6
N=7=>Goto 7
N=8=>Goto 8
N=9=>Goto 9
Plot V,W
Plot V+2,W:Line
Plot V+2,W+4:Line
Plot V,W+4:Line
Plot V,W:Line
Goto 0
Lbl 1
Plot V+1,W
Plot V+1,W+4:Line
Goto 0
Lbl 2
Plot V+2,W
Plot V,W:Line
Plot V,W+2:Line
Plot V+2,W+2:Line
Plot V+2,W+4:Line
Plot V,W+4:Line
Goto 0
Lbl 3
Plot V,W
Plot V+2,W:Line
Plot V+2,W+4:Line
Plot V,W+4:Line
Plot V,W+2
Plot V+2,W+2:Line
Goto 0
Lbl 4
Plot V+2,W
Plot V+2,W+4:Line
Plot V+2,W+1:Line
Plot V,W+1:Line
Plot V,W+4:Line
Goto 0
Lbl 5
Plot V,W
Plot V+2,W:Line
Plot V+2,W+2:Line
Plot V,W+2:Line
Plot V,W+4:Line
Plot V+2,W+4:Line
Goto 0
Lbl 6
Plot V+2,W+4
Plot V,W+4:Line
Plot V,W:Line
Plot V+2,W:Line
Plot V+2,W+2:Line
Plot V,W+2:Line
Goto 0
Lbl 7
Plot V,W
Plot V+2,W+4:Line
Plot V,W+4:Line
Goto 0
Lbl 8
Plot V,W
Plot V+2,W:Line
Plot V+2,W+4:Line
Plot V,W+4:Line
Plot V,W:Line
Plot V,W+2:Line
Plot V+2,W+2:Line
Goto 0
Lbl 9
Plot V,W
Plot V+2,W:Line
Plot V+2,W+4:Line
Plot V,W+4:Line
Plot V,W+2:Line
Plot V+2,W+2:Line
Lbl 0
___________________________________________________________________

       FURTHER NOTES 
       Anyone who wants to be clever could make this a one-player game
       by disabling some of the code like the enemy Prog, and setting
       up a counter to count the no. of shots it takes you to hit all
       the other ships.
       
       To win every time, tell your opponent 0460460461 and 0460461
       to type in at the start, and he will never find your ships.

       Any problems with the program, send me an email at:

                Maverick - 106053.2370@compuserve.com
___________________________________________________________________

